<template>
  <div id="app">
    <keep-alive :include="/-needCache-$/">
      <router-view />
    </keep-alive>
    <tabbar></tabbar>
  </div>
</template>

<script>
import tabbar from "./components/tabbar.vue"; //引用组件的地址
import { Dialog } from "vant";
//import kefu from './components/kefu.vue'
import Fetch from "./utils/fetch";

export default {
  name: "App",
  components: {
    tabbar,
  },
  data() {
    return {
      footer_type: "n2",
      show_footer: false,
      show_type: "index",
      show_news: false,
    };
  },
  //components: {
  //		kefu
  //	},
  created() {
    // var type = localStorage.getItem('footer');
    // if (type) {
    //     this.footer_type = type;
    // }
  },
  mounted() {
    this.timer = setInterval(() => {
      this.syncDevNo();
    }, 4500);
    // Fetch("/api/api/tree").then((res) => {
    //   if (res.data.adv_icon.length != 0) {
    //     this.show_news = true;
    //   } else {
    //     this.show_news = false;
    //   }
    // });
  },
  methods: {
    //是否显示底部
    footer: function (bool, show = "index") {
      this.show_footer = bool;
      this.show_type = show;
    },
    syncDevNo() {
      let devNo = localStorage.getItem("dev_no"),
        devType = localStorage.getItem("dev_type"),
        devOaid = localStorage.getItem("dev_oaid"),
        devIdfa = localStorage.getItem("dev_idfa");
      if (devNo || 1) {
        Fetch(
          "/api/api/sync",
          {
            dev_no: devNo,
            dev_type: devType,
            dev_oaid: devOaid,
            dev_idfa: devIdfa,
          },
          null,
          false
        ).then((r) => {
          if (r.data.is_open_notice_dialog) {
            this.openNoticeDialog();
          }
        });
      }
    },
    openNoticeDialog() {
      Dialog.confirm({
        title: "提示",
        message: "您有新消息，是否前往查看?",
      })
        .then(() => {
          this.$router.push("/notice");
        })
        .catch(() => {
          return;
        });
    },
  },
};
</script>
<style >
body {
  background: #f6f6f6;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: scroll;
  position: relative;
}

#app {
  font-family: PingFangSC-Regular, PingFang SC, AliHYAiHei-Beta, AliHYAiHei,
    "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #333333;
  width: 100%;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  position: absolute;
  left: 0;
  top: 0;
  /* overflow: hidden; */
}
.disf {
  display: flex;
}
.disf_jc {
  justify-content: space-between;
}

#app::-webkit-scrollbar {
  display: none;
}

html,
body {
  height: 100%;
  -webkit-touch-callout: none;
  /*系统默认菜单被禁用*/
  -webkit-user-select: none;
  /*webkit浏览器*/
  -khtml-user-select: none;
  /*早起浏览器*/
  -moz-user-select: none;
  /*火狐浏览器*/
  -ms-user-select: none;
  /*IE浏览器*/
  user-select: none;
  /*用户是否能够选中文本*/
}
input,
select {
  -webkit-user-select: auto;
  /*webkit浏览器*/
  user-select: auto;
  /*用户是否能够选中文本*/
}
body,
html,
div,
a,
p,
h1,
h2,
h3,
h4,
span,
ul,
li {
  margin: 0;
  padding: 0;
}
.van-nav-bar {
  /* box-shadow: 0px 1px 2px 0px #e1e1e1; */
}
.van-nav-bar .van-icon {
  color: #20253a;
}
.van-nav-bar__text {
  color: #20253a;
}

.clearfix {
  display: block;
  content: "";
  clear: both;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}

.clearfix:after {
  clear: both;
}
</style>